package com.zhdl.network.service.dto;

import lombok.Data;

@Data
public class SingleParaInfo {
    /**
     * 序号，无符号。0-255
     */
    private byte id;

    /**
     * 对应数据的长度 （0:无数据,因不支持或者异常）
     */
    private byte length;

    /**
     * 数据，暂不解析，到具体的对象对象是解析
     */
    private byte[] data;

    public SingleParaInfo(int id, byte[] data) {
        this.id = (byte) id;
        this.data = data;
        this.length = (byte) data.length;
    }

    public SingleParaInfo(int id, byte data) {
        this.id = (byte) id;
        this.data = new byte[]{data};
        this.length = (byte) this.data.length;
    }

    public SingleParaInfo() {
    }

    public void setData(byte[] data) {
        this.data = data;
        this.length = (byte) data.length;
    }

}
